<template>
  <div class="title">
    <div class="content">
      <div class="name">{{ name }}</div>
      <div class="more" v-if="show">
        <a @click.prevent="toggel" href=""
          >{{ more }} <el-icon><arrow-right /></el-icon
        ></a>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { useRouter } from 'vue-router'

export default defineComponent({
  props: {
    name: {
      type: String,
      default: '名字'
    },
    more: {
      type: String,
      default: '更多'
    },
    path: {
      type: String,
      default: '/home/rtsongs'
    },
    show: {
      type: Boolean,
      default: true
    }
  },
  setup(props) {
    const router = useRouter()
    function toggel() {
      router.push(props.path)
    }
    return {
      toggel
    }
  }
})
</script>

<style scoped lang="less">
.title {
  width: 100%;
  display: flex;
  color: #333;
  margin-top: 10px;
  .content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);

    .more {
      font-size: 12px;
      text-align: center;
      position: relative;
      top: 6px;
    }

    .name {
      font-size: 19px;
    }
  }
}
</style>
